const url=require('url')
// let urlString='https://gitee.com/fujun1997/vue_shop/settings'
// //字符串转为对象
// let obj=url.parse(urlString,true)
// console.log(obj)

let obj={
    protocol: 'https:',
    slashes: true,
    auth: null,
    host: 'gitee.com',
    port: null,
    hostname: 'gitee.com',
    hash: null,
    search: null,
    query: [{Object: null}],
    pathname: '/fujun1997/vue_shop/settings',
    path: '/fujun1997/vue_shop/settings',
    href: 'https://gitee.com/fujun1997/vue_shop/settings'
  }
  //对象转为字符串
  let str=url.format(obj)
  console.log(str)